<!DOCTYPE html>
<html>
    <head>
        <title>Allowed with Unicode characters</title>
    </head>
    <body>
        <script src="/resources/testharness.js"></script>
        <script src="/resources/testharnessreport.js"></script>

        <script>
            // The tl;dr is that SRI should work on the raw bytes, so different
            // Unicode characters should have no affect on the SRI behavior.
            // More or less regression tests for https://crbug.com/527286.
            function runTest(src, integrity, name) {
                var t = async_test('SRI: ' + name);
                t.step(function() {
                    var script = document.createElement("script");
                    script.src = 'resources/' + src;
                    script.onerror = function() {
                        assert_unreached();
                    };
                    script.onload = function() {
                        t.done();
                    };
                    script.setAttribute("integrity", integrity);
                    document.head.appendChild(script);
                });
            }

            runTest('unicode-result1.js',
                    'sha256-Jsg0LTUcWJCW0Yx9hJ/NlI3xyGhAq+QbOeYhFZPW7pE=',
                    'High Unicode block');
            runTest('unicode-result2.js',
                    'sha256-CH/a0Hewkos2JMgFcHNnkfQ3vGxpPT776spz6EpkOd4=',
                    'Unicode combined characters');
            runTest('unicode-result3.js',
                    'sha256-Gapl2CGyywaxA8Ywq6X+hUQJugb8J91t1JkbaPXJIsw=',
                    'Right-to-left characters');
            runTest('unicode-result4.js',
                    'sha256-kcdF6tdn9B5aUK+RUnFs5WtaGzGdy2WVRhHgTGcy0pw=',
                    'Mixed right-to-left and left-to-right');
        </script>
    </body>
</html>
